import random

listExperiments = ['e1', 'e2', 'e3', 'e4', 'e5', 'e6']

# Select a new experiment sequentially
def pickSeqOtherExperiment(experiment):
    expNext = ''
    for item in listExperiments:
        if experiment == '' or expNext == 'Next':
            expNext = item
            break
        if item == experiment:
            expNext = 'Next'
    if expNext == 'Next':
        expNext = listExperiments[0]
    return expNext


# Select a new experiment randomly
def pickRandOtherExperiment(experiment):
    expNext = random.choice(listExperiments)
    # Still avoid repeating last experiment
    while expNext == experiment:
        expNext = random.choice(listExperiments)
    return expNext


def pickOtherExperiment(experiment, randomFlag = False, supressLog = True):
    if randomFlag:
        expNext = pickRandOtherExperiment(experiment)
        if not supressLog:
            print('Next Random Other Experiment' + (': ' if experiment == '' else '(Except ' + experiment + '): ') + expNext)
    else:
        expNext = pickSeqOtherExperiment(experiment)
        if not supressLog:
            print('Next Sequential Other Experiment' + (': ' if experiment == '' else '(Except ' + experiment + '): ') + expNext)
    return expNext